﻿using System;
using System.Windows.Media;

namespace TraceView.UI.Entities
{
    public sealed class UserInfo : FilterEntity
    {
        private Color _color;
        private string _machineName;
        private string _name;

        public UserInfo(string machineName)
        {
            MachineName = machineName;
        }

        public Color Color
        {
            get { return _color; }
            set { SetProperty(() => Color, ref _color, value); }
        }

        public string Name
        {
            get { return _name; }
            set { SetProperty(() => Name, ref _name, value); }
        }

        public string MachineName
        {
            get { return _machineName; }
            set { SetProperty(() => MachineName, ref _machineName, value); }
        }

        public override string KeyValue
        {
            get { return MachineName; }
        }
    }

    public sealed class UserCollection : FilterEntityCollection<UserInfo>
    {
        protected override bool TraceItemMatches(UserInfo item, TraceItem traceItem)
        {
            return traceItem.UserName.Equals(item.Name, StringComparison.OrdinalIgnoreCase);
        }
    }
}